import Vue from 'vue'
import VueRouter from 'vue-router'
import Default from '../views/layout/default'
import Page from '../views/layout/page'
import Home from '../views/pages/home'
import User from '../views/pages/user/index'
import Teacher from '../views/pages/teacher/index'
import TeacherAdd from '../views/pages/teacher/add'
import Course from '../views/pages/course/index'
import Catalog from '../views/pages/course/catalog'
import Order from '../views/pages/order/index'
import Login from '../views/pages/login'
import AddCourse from '../views/pages/course/add-course'
import AddCatalog from '../views/pages/course/add-catalog'
import Banner from '../views/pages/banner/index'
import BannerAdd from '../views/pages/banner/add'
import Link from '../views/pages/link/index'
import Comment from '../views/pages/comment/index'
import Category from '../views/pages/category/index'
import Distribution from '../views/pages/distribution/index'
import Vip from '../views/pages/vip/index'
import VipAdd from '../views/pages/vip/add'
import VipCard from '../views/pages/vip/card'
import VipCardAdd from '../views/pages/vip/add-card'
import Card from '../views/pages/card/index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Default,
    children: [
      {
        path: '/',
        name: 'website',
        component: Home,
        meta: { title: '网站设置', icon: 'el-icon-s-tools' }
      },
      {
        path: '/user/',
        name: 'user-index',
        component: User,
        meta: { title: '用户管理', icon: 'el-icon-user-solid' }
      },
      {
        path: '/teacher/',
        component: Page,
        meta: { title: '讲师管理', icon: 'el-icon-s-custom' },
        children: [
          {
            path: '',
            name: 'teacher-index',
            component: Teacher,
            meta: { title: '讲师列表' }
          },
          {
            path: 'add',
            name: 'add-teacher',
            component: TeacherAdd,
            meta: { hidden: true }
          }
        ]
      },
      {
        path: '/course/',
        component: Page,
        meta: { title: '课程管理', icon: 'el-icon-s-opportunity' },
        children: [
          {
            path: 'category',
            name: 'course-category',
            component: Category,
            meta: { title: '课程分类' }
          },
          {
            path: '',
            name: 'course-index',
            component: Course,
            meta: { title: '课程列表' }
          },
          {
            path: 'catalog',
            name: 'course-catalog',
            component: Catalog,
            meta: { title: '目录管理' }
          },
          {
            path: 'add',
            name: 'add-course',
            component: AddCourse,
            meta: { hidden: true }
          },
          {
            path: 'catalog/add',
            name: 'add-catalog',
            component: AddCatalog,
            meta: { hidden: true }
          }
        ]
      },
      {
        path: '/comment',
        component: Comment,
        meta: { title: '评论管理', icon: 'el-icon-s-comment' }
      },
      {
        path: '/order',
        component: Order,
        meta: { title: '订单管理', icon: 'el-icon-s-order' }
      },
      {
        path: '/cards',
        component: Card,
        meta: { title: '卡密管理', icon: 'el-icon-bank-card' }
      },
      {
        path: '/link',
        component: Link,
        name: 'link',
        meta: { title: '友链管理', icon: 'el-icon-link' }
      },
      {
        path: '/banner/',
        component: Page,
        meta: { title: '轮播管理', icon: 'el-icon-picture' },
        children: [
          {
            path: '',
            name: 'banner-index',
            component: Banner,
            meta: { title: '轮播列表' }
          },
          {
            path: 'add',
            name: 'banner-add',
            component: BannerAdd,
            meta: { hidden: true }
          }
        ]
      },
      {
        path: '/vip/',
        component: Page,
        meta: { title: '会员卡管理', icon: 'el-icon-s-finance' },
        children: [
          {
            path: '',
            name: 'vip-list',
            component: Vip,
            meta: { title: '卡类型列表' }
          },
          {
            path: 'card/',
            name: 'vip-card-list',
            component: VipCard,
            meta: { title: '会员卡列表' }
          },
          {
            path: 'card/add',
            name: 'vip-card-add',
            component: VipCardAdd,
            meta: { hidden: true }
          },
          {
            path: 'add',
            name: 'vip-add',
            component: VipAdd,
            meta: { hidden: true }
          }
        ]
      },
      {
        path: '/distribution/',
        name: 'distribution',
        component: Distribution,
        meta: { title: '分销设置', icon: 'el-icon-s-marketing' }
      }
    ]
  },
  { path: '/login', component: Login, name: 'login' }
]

const router = new VueRouter({
  routes
})

export default router
